package com.yuye.cloud.common.context;

import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * 负载均衡策略Holder  如果是相同ip 就调用同一个ip的机器
 *
 * @author xgf
 */
public class IpIsolationContextHolder {
    private static final ThreadLocal<String> IP_CONTEXT = new TransmittableThreadLocal<>();

    public static void setIp(String version) {
    	IP_CONTEXT.set(version);
    }

    public static String getIp() {
        return IP_CONTEXT.get();
    }

    public static void clear() {
    	IP_CONTEXT.remove();
    }
}
